package Game.Buff;

import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;

import Game.Objects.GOPlayer;
import Game.Objects.GameObject;
import Game.Objects.Creatures.GOCreature;

/** Debuff Poison class
 * Description: sub 1 hp
 * @author Aikidos
 */
public class DebuffPoison extends BuffBase {

	public DebuffPoison(BuffManager buffManager) throws SlickException {
		super(buffManager);
		
		setNumOfSteps(5);
		
		_icon = new Image("res/gfx/buff/poison.png");
	}

	@Override
	public void step() {
		super.step();
		
		GameObject obj = getBuffManager().getOwner();
		
		// Player
		if (obj.isPlayer()) {
			GOPlayer player = (GOPlayer)obj;
			
			player.subHealth(1);
		}
		
		// Creature
		if (obj.isCreature()) {
			GOCreature creature = (GOCreature)obj;
			
			creature.subHealth(1);
		}
	}
	
}
